package com.ruiyun.ruinews.fragment;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.ruiyun.ruinews.R;
import com.ruiyun.ruinews.adapter.NewsClassRecycleAdapter;
import com.ruiyun.ruinews.base.BaseFragment;
import com.ruiyun.ruinews.entity.HeadLines;
import com.ruiyun.ruinews.tool.DividerItemDecoration;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by zouhui on 16/1/7.
 */
public class NewsClassFragment extends BaseFragment {
    private String content;
    private TextView textView;
    private RecyclerView recyclerView;
    private NewsClassRecycleAdapter adapter;
    private List<HeadLines> data;
    private List<Integer> headerData;

    public NewsClassFragment(String content) {
        this.content = content;
    }

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.fragment_newsclass, null);
        init(view);
        return view;
    }

    private void getData(){
        headerData = new ArrayList<>();
       headerData.add(R.mipmap.c);
        headerData.add(R.mipmap.d);
        headerData.add(R.mipmap.e);
        headerData.add(R.mipmap.f);
    }
    private void init(View view) {
        recyclerView = (RecyclerView) view.findViewById(R.id.recycleView_newsclass);
        adapter = new NewsClassRecycleAdapter(context,data,headerData);
        recyclerView.setLayoutManager(new LinearLayoutManager(context));
        recyclerView.addItemDecoration(new DividerItemDecoration(context, DividerItemDecoration.VERTICAL_LIST));
        recyclerView.setAdapter(adapter);
    }
}
